A stochastic algorithm for the recursive approximation of the location $\theta$ of a maximum of a regression function was introduced by Kiefer and Wolfowitz [Ann. Math. Statist. 23 (1952) 462--466] in the univariate framework, and by Blum [Ann. Math. Statist. 25 (1954) 737--744] in the multivariate case. The aim of this paper is to provide a companion algorithm to the Kiefer--Wolfowitz--Blum algorithm, which allows one to simultaneously recursively approximate the size $\mu$ of the maximum of the regression function. A precise study of the joint weak convergence rate of both algorithms is given; it turns out that, unlike the location of the maximum, the size of the maximum can be approximated by an algorithm which converges at the parametric rate. Moreover, averaging leads to an asymptotically efficient algorithm for the approximation of the couple $(\theta,\mu)$.